<template>
  <div class='container'>
    <u-sticky>
      <u-gap height="10" bgColor="#f5f5f5"></u-gap>
      <view class="tab">
        <u-tabs :list="list" @click="select"></u-tabs>
      </view>
    </u-sticky>
    <!-- 盘点记录 -->
    <view class="list" v-if="activeIndex==0">
      <u-empty v-if="inventory.length===0" mode="list">
      </u-empty>
      <view class="list-item" v-for="(v,i) in inventory" :key="i">
        <view class="list-item-left">
          <u-icon name="play-right-fill" color="#0d6fb8"></u-icon>
        </view>
        <view class="list-item-right">
          <view class="no">资产编号: {{v.assetsNo}}</view>
          <view class="name">资产名称: {{v.assetsName}}</view>
          <view>盘点人: {{v.creatUserName}} </view>
          <view>备注: {{v.remarks}} </view>
          <view>盘点时间: {{v.createTime}} </view>

        </view>

      </view>
    </view>

    <!-- 调度记录 -->
    <view class="list" v-if="activeIndex==1">
      <u-empty v-if="divert.length===0" mode="list">
      </u-empty>
      <view class="list-item" v-for="(v,i) in divert" :key="i">
        <view class="list-item-left">
          <u-icon name="play-right-fill" color="#0d6fb8"></u-icon>
        </view>
        <view class="list-item-right">
          <view class="no">工单号: {{v.no}}</view>
          <view class="name">申请人: {{v.creatUserName}}</view>
          <view>使用单位: {{v.divertDept}} </view>
          <view>创建时间: {{v.createTime}} </view>
          <view>流程状态: {{v.state}} </view>
          <view>当前流程节点: {{v.exNode}} </view>
        </view>

      </view>
    </view>

    <!-- 申报记录 -->
    <view class="list" v-if="activeIndex==2">
      <u-empty v-if="addLog.length===0" mode="list">
      </u-empty>
      <view class="list-item" v-for="(v,i) in addLog" :key="i">
        <view class="list-item-left">
          <u-icon name="play-right-fill" color="#0d6fb8"></u-icon>
        </view>
        <view class="list-item-right">
          <view class="no">工单号: {{v.no}}</view>
          <view class="name">申请人: {{v.creatUserName}}</view>
          <view>使用单位: {{v.divertDept}} </view>
          <view>创建时间: {{v.createTime}} </view>
          <view>流程状态: {{v.state}} </view>
          <view>当前流程节点: {{v.exNode}} </view>
        </view>

      </view>
    </view>

  </div>
</template>

<script>
export default {
  data() {
    return {
      list: [{
        name: '盘点记录',
      }, {
        name: '调度记录',
      }, {
        name: '新增申报记录',
      }],
      inventory: [],//盘点记录
      divert: [],//调度记录
      addLog: [],//申报记录
      activeIndex: 0,
      assetNo: ''
    };
  },
  onLoad(e) {

    this.assetNo = e.assetNo
    this.GetAssetLog()

  },

  methods: {
    GetAssetLog() {
      this.$u.api.GetAssetLog({ assetNo: this.assetNo }).then(res => {
        this.inventory = res.data.inventory
        this.divert = res.data.divert
        this.addLog = res.data.addLog
      })
    },

    select(e) {

      this.activeIndex = e.index
      this.GetAssetLog()
    }

  }
};
</script>

<style scoped lang="scss">
.container {
  min-height: 100vh;
  background: #fff;
  .title {
    height: 100rpx;
    line-height: 100rpx;
    font-size: 34rpx;
    text-align: center;
  }
  .tab {
    background: #fff;
    /deep/.u-tabs__wrapper__nav__item {
      width: 33%;
      box-sizing: border-box;
    }
  }
  .list {
    .list-item {
      display: flex;
      position: relative;
      padding: 20rpx 30rpx;
      border-bottom: #f5f5f5 1rpx solid;

      .list-item-left {
        margin-right: 20rpx;
        display: flex;
      }

      .list-item-right {
        view {
          font-size: 24rpx;
          line-height: 36rpx;
          color: #999999;
        }

        .no {
          font-size: 24rpx;
          line-height: 36rpx;
          color: #999999;
        }

        .name {
          font-family: PingFang-SC-Bold;
          font-size: 30upx;
          font-weight: normal;
          letter-spacing: 0px;
          color: #333333;
        }
      }
    }
  }
}
</style>
